home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / System / BoingBag1 / Contributions / Workbench / RexxArpLib3p6 / rexx / ScreenTest.rexx < prev    next >
OS/2 REXX Batch file  |  1998-06-26  |  6KB  |  192 lines

  1. /*
  2.  *        ScreenTest.rexx
  3.  *            Script for testing rexxarplib.library screen usages.
  4.  *
  5.  */
  6.  
  7. ScreenTest:
  8.  
  9.     options results
  10.     options failat 200
  11.     signal on syntax
  12.  
  13.     debugging = 0                        /* set if we want debug messages */
  14.  
  15.     arg quick .
  16.     if (quick = '') then
  17.     do
  18.  
  19.         say "All test screens are named 'MNS'. If one is left open the following command:"
  20.         say 'rx "call closescreen(''MSN'')"'
  21.         say
  22.         /*
  23.          *    Get the global options that we need for various uses.
  24.          */
  25.  
  26.         editor    = ""
  27.         pubscreen = ""
  28.  
  29.         if editor = "" then
  30.             editor = getenv("editor")
  31.  
  32.         say "getenv done"
  33.  
  34.         /*
  35.          *  Set up a host
  36.          */
  37.          say
  38.          say "Setting up for a misnamed pubscreen window open. The test window should"
  39.          say "appear on the WorkBench screen."
  40.          say
  41.  
  42.         pubscreen = 'NOTMNS'
  43.  
  44.         /* Screen pen indices */
  45.         /* 1 = screen title text         default = 1 */
  46.         /* 2 = screen title background  default = 2 */
  47.         /* 3 = gadget text                default = 1 */
  48.         /* 4 = highlights                default = 2 */
  49.         /* 5 = shadows                    default = 1 */
  50.         /* 6 = active window highlight    default = 3 */
  51.         /* 7 = active window text        default = 1 */
  52.         /* 8 = screen background        always  = 0 */
  53.         /* 9 = Highlight Text Pen        default = 1 */
  54.         call OpenScreen( 0, 2, 'HIRES LACE OVERSCAN', 'My new screen!', 'MNS', '121213102', 724, 482, 0 )
  55.  
  56.         address arexx "'x = CreateHost(TESTSTUFF, TESTSTUFF_PORT, "pubscreen")'"
  57.  
  58.         /*
  59.          *  Wait until it is ready. It times out after a while, so do
  60.          *    a few of them.  May not be necessary, try it on your system
  61.          *    for best results.
  62.          */
  63.         WaitForPort TESTSTUFF
  64.         WaitForPort TESTSTUFF
  65.         WaitForPort TESTSTUFF
  66.  
  67.         /*
  68.          *  Open the window
  69.          */
  70.  
  71.  
  72.         idcmp = 'CLOSEWINDOW+GADGETUP'
  73.         flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+BACKFILL'
  74.         call OpenWindow(TESTSTUFF, 200, 100, 240, 133, idcmp, flags, "BixParse Shell Options")
  75.         say "Window open delaying 1 sec"
  76.         call delay(50)
  77.  
  78.         call AddGadget(TESTSTUFF, 10,  35, 'S', ' Post Conference Message   ',   'S')
  79.         call AddGadget(TESTSTUFF, 10,  47, "RE"," Post Bug Report           ",   "RE")
  80.  
  81.         call AddGadget(TESTSTUFF, 10,  64, "M", " Send Mail to...           ",   "M")
  82.         call AddGadget(TESTSTUFF, 10,  76, "E", " Edit Mail Lists           ",   "E")
  83.         call AddGadget(TESTSTUFF, 10,  88, "CH"," Get Charges               ",   "CH")
  84.  
  85.         call AddGadget(TESTSTUFF, 10, 105, "RC"," Read Last Conference Msgs ",   "RC")
  86.         call AddGadget(TESTSTUFF, 10, 117, "RM"," Read Last Mail Messages   ",   "RM")
  87.  
  88.         call ActivateWindow(TESTSTUFF)                /* make it the active one! */
  89.  
  90.         say "Delay 4 seconds"
  91.         call delay(200)
  92.         say "Closing window"
  93.         call CloseWindow(TESTSTUFF)
  94.         say "Delaying 1 second"
  95.         call delay(50)
  96.  
  97.         call CloseScreen('MNS')
  98.     end
  99.  
  100.     /*    Now go around for a second legal try */
  101.     say
  102.     say
  103.     say "Setting up for access to the correct screen."
  104.     say "Test window should open on the new screen."
  105.     say
  106.  
  107.     pubscreen = 'MNS'
  108.     /* Screen pen indices */
  109.     /* 1 = screen title text         default = 1 */
  110.     /* 2 = screen title background  default = 2 */
  111.     /* 3 = gadget text                default = 1 */
  112.     /* 4 = highlights                default = 2 */
  113.     /* 5 = shadows                    default = 1 */
  114.     /* 6 = active window highlight    default = 3 */
  115.     /* 7 = active window text        default = 1 */
  116.     /* 8 = screen background        always  = 0 */
  117.     /* 9 = Highlight Text Pen        default = 1 */
  118.                                                                         /*  123456789 */
  119.     call OpenScreen( 0, 2, 'HIRES LACE OVERSCAN', 'My new screen!', 'MNS', '121213101', 724, 482, 0 )
  120.  
  121.     address arexx "'x = CreateHost(TESTSTUFF, TESTSTUFF_PORT, "pubscreen")'"
  122.     /*
  123.      *  Wait until it is ready. It times out after a while, so do
  124.      *    a few of them.  May not be necessary, try it on your system
  125.      *    for best results.
  126.      */
  127.     WaitForPort TESTSTUFF
  128.     WaitForPort TESTSTUFF
  129.     WaitForPort TESTSTUFF
  130.  
  131.     /*
  132.      *  Open the window
  133.      */
  134.  
  135.  
  136.     idcmp = 'CLOSEWINDOW+GADGETUP'
  137.     flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+BACKFILL'
  138.     call OpenWindow(TESTSTUFF, 200, 100, 240, 133, idcmp, flags, "BixParse Shell Options")
  139.     say "Window open delaying 1 sec"
  140.     call delay(50)
  141.  
  142.     /*
  143.      *  Add all the gadgets
  144.     call AddGadget(controlport, x, y, gadgetid, gadgettext, messagetext,
  145.                   hsize, flags)
  146.         If hsize is specified, this call creates a string gadget of that
  147.         horizontal size and gadgettext is the default string. If hsize is
  148.         not specified, this call creates an autosizing boolean gadget, where
  149.         the text in gadgettext is displayed. In both cases, the string in
  150.         messagetext is sent to controlport (see also under OpenWindow). As
  151.         usual, the gadgettext for boolean gadgets may contain \ characters
  152.         to cause multiple lines of text (See e.g. PostMsg()). Under 2.0,
  153.         a flag can be specified for string gadgets: RIDGEBORDER. This will
  154.         cause the gadget to be displayed in the "2.0" style. Since this style
  155.         of gadget is a little different in size and location than non-ridge
  156.         border gadgets, the default is the usual gadget border under 1.3 and
  157.         a "recessed" gagdet under 2.0.
  158.  
  159.      */
  160.  
  161.  
  162.     call AddGadget(TESTSTUFF, 10,  35, 'S', ' Post Conference Message   ',   'S')
  163.     call AddGadget(TESTSTUFF, 10,  47, "RE"," Post Bug Report           ",   "RE")
  164.  
  165.     call AddGadget(TESTSTUFF, 10,  64, "M", " Send Mail to...           ",   "M")
  166.     call AddGadget(TESTSTUFF, 10,  76, "E", " Edit Mail Lists           ",   "E")
  167.     call AddGadget(TESTSTUFF, 10,  88, "CH"," Get Charges               ",   "CH")
  168.  
  169.     call AddGadget(TESTSTUFF, 10, 105, "RC"," Read Last Conference Msgs ",   "RC")
  170.     call AddGadget(TESTSTUFF, 10, 117, "RM"," Read Last Mail Messages   ",   "RM")
  171.  
  172.     call ActivateWindow(TESTSTUFF)                /* make it the active one! */
  173.  
  174.  
  175.     say "Delaying 4 seconds"
  176.     call delay(200)
  177.     say "Closing window only"
  178.     call CloseWindow(TESTSTUFF)
  179.     say "Delaying 1 second"
  180.     call delay(50)
  181.     say "Trying to open the same screen again. Should fail and leave screen."
  182.     say "If it is left behind issue the command:"
  183.     say 'rx "call closescreen(''MSN'')"'
  184.     say OpenScreen( 0, 2, 'HIRES LACE OVERSCAN', 'My new screen!', 'MNS', '011213102', 724, 482, 0 )
  185.     say rc results "FAILED: OpenScreen did not leave the old screen behind!"
  186. exit
  187.  
  188. syntax:
  189.     say CloseScreen("MNS")
  190.     say "PASSED: Closed 'MNS' at the correct time."
  191. exit
  192.